package com.ruoyi.project.rest.goods.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.rest.goods.mapper.RestGoodsMapper;
import com.ruoyi.project.rest.goods.domain.RestGoods;
import com.ruoyi.project.rest.goods.service.IRestGoodsService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 商品Service业务层处理
 * 
 * @author jfj
 * @date 2022-03-28
 */
@Service
public class RestGoodsServiceImpl implements IRestGoodsService 
{
    @Autowired
    private RestGoodsMapper restGoodsMapper;

    /**
     * 查询商品
     * 
     * @param id 商品主键
     * @return 商品
     */
    @Override
    public RestGoods selectRestGoodsById(Long id)
    {
        return restGoodsMapper.selectRestGoodsById(id);
    }

    /**
     * 查询商品列表
     * 
     * @param restGoods 商品
     * @return 商品
     */
    @Override
    public List<RestGoods> selectRestGoodsList(RestGoods restGoods)
    {
        return restGoodsMapper.selectRestGoodsList(restGoods);
    }

    /**
     * 新增商品
     * 
     * @param restGoods 商品
     * @return 结果
     */
    @Override
    public int insertRestGoods(RestGoods restGoods)
    {
        restGoods.setCreateTime(DateUtils.getNowDate());
        return restGoodsMapper.insertRestGoods(restGoods);
    }

    /**
     * 修改商品
     * 
     * @param restGoods 商品
     * @return 结果
     */
    @Override
    public int updateRestGoods(RestGoods restGoods)
    {
        return restGoodsMapper.updateRestGoods(restGoods);
    }

    /**
     * 批量删除商品
     * 
     * @param ids 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteRestGoodsByIds(String ids)
    {
        return restGoodsMapper.deleteRestGoodsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商品信息
     * 
     * @param id 商品主键
     * @return 结果
     */
    @Override
    public int deleteRestGoodsById(Long id)
    {
        return restGoodsMapper.deleteRestGoodsById(id);
    }
}
